#include<signal.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>

int main()
{
    sigset_t set;
    sigset_t oldset;
    sigaddset(&set,SIGINT);
    if(sigprocmask(SIG_BLOCK,&set,&oldset)== -1)
    {
        perror("fail to sigpromask");
        exit(-1);
    }
    int k = 0;
    while(1)
    {
        printf("睡眠%ds\n",k+1);
        sleep(1);
        k++;
        if(k == 5)
        {
            if(sigprocmask(SIG_UNBLOCK,&set,&oldset)== -1)
            {
                perror("fail to sigpromask");
                exit(-1);
            }
        }
    }
    return 0;
}
